#include "greetingdialog.h"
#include <QPixmap>
#include <QFont>

GreetingDialog::GreetingDialog(QWidget *parent) : QDialog(parent)
{
    setFixedSize(360, 500);
    setWindowTitle("欢迎到来");

    m_pixChess.load(":/picture/whyiami.png");
    m_lblPix.setPixmap(m_pixChess);
    m_lblPix.setScaledContents(true);
    m_lblPix.setFixedWidth(width()*0.94);
    m_lblPix.setAlignment(Qt::AlignCenter);

    QFont font("KaiTi");
    font.setPixelSize(25);

    m_lblGreet1.setFont(font);
    m_lblGreet1.setAlignment(Qt::AlignCenter);
    m_lblGreet1.setText("惜字公莊\n之");
    font.setFamily("STXinwei");
    font.setPixelSize(40);
    m_lblGreet2.setFont(font);
    m_lblGreet2.setAlignment(Qt::AlignCenter);
    m_lblGreet2.setText("深思象棋");

    m_btnOk.setText("开始游戏");
    m_btnOk.setFixedWidth(150);
    m_btnOk.setFixedHeight(40);
    font.setFamily(font.defaultFamily());
    font.setPixelSize(20);
    m_btnOk.setFont(font);
    connect(&m_btnOk, &QPushButton::clicked, this, &QDialog::close);

    m_hBox.addStretch();
    m_hBox.addWidget(&m_btnOk);
    m_hBox.addStretch();

    m_vBox.addWidget(&m_lblPix);
    m_vBox.addWidget(&m_lblGreet1);
    m_vBox.addWidget(&m_lblGreet2);
    m_vBox.addLayout(&m_hBox);
    setLayout(&m_vBox);
}
